<# # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script is designed To Enable the Integrated Webcam driver # Configuration Type - COMPUTER #> try { # Attempt to get the 'Integrated Webcam' device with an error or disabled status $camera = Get-PnpDevice -FriendlyName 'Integrated Webcam' -Class Camera # Check if the device was found and if it's disabled or has an error status if ($camera) { if ($camera.Status -eq 'Error' -or $camera.Status -eq 'Disabled') { # Attempt to enable the device Enable-PnpDevice -InstanceId $camera.InstanceId -Confirm:$false Write-Host "The 'Integrated Webcam' has been successfully enabled." } else { Write-Host "The 'Integrated Webcam' is already enabled (Status: $($camera.Status))." } } else { Write-Host "No 'Integrated Webcam' device found." } } catch { # If an error occurs, display the error message and the error code Write-Host "An error occurred: $($_.Exception.Message)" Write-Host "Error Code: $($_.Exception.HResult)" }